#6-coef-figuresb.r


sign.n <- 1
hjust.n <- -0.2


pvalues <- round((statement.results[r2,]$p),3)
pvalues.labels <- paste(rep("p=",length(pvalues)), pvalues, sep="")


title.f <- paste(main.t, type, "-", dv.n, sep="")
title.fig <- paste(title.w, " ", dv.n, ", ", type, sep="")

if (covs!=""){
  title.f <- paste(main.t, type, "-", dv.n, "-", covs, sep="")
  title.fig <- paste(title.w, " ", dv.n, ", ", type, ", ", covs, sep="")
}

ggplot(statement.results[r2,]) +    
  geom_linerange(aes(x = names4, ymin = sign.n * est - outerCI.n*se, ymax = sign.n * est + outerCI.n*se), lwd=0.5, col="black") +
  geom_linerange(aes(x = names4, ymin =  sign.n * est - innerCI.n*se, ymax = sign.n * est + innerCI.n*se), lwd=1.5, col="black") +
  geom_text(aes(x=names4, y=est, vjust=-.7, hjust=hjust.n, label=pvalues.labels, size=.7))   +   #paste("p=",round(p/2,3),sep="")
  geom_point(aes(x = names4, y=sign.n * est), size=5) +
  coord_flip() +
  ylab(paste("Change in ", dv.n, sep="")) + 
  xlab("") +
  geom_hline(yintercept=0, col="black") +
  ggtitle(title.fig) +
  theme_bw() + theme(legend.position="none")

p <- recordPlot()

pdf(paste(fig.loc,title.f,".pdf", sep=""), width=9, height=3)
p
dev.off()

pvalues <- -1
